import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
    {
        path: '/',
        name: 'Home',
        component: () => import('@/view/home.vue'),
        meta: {
            tabBar: true,
            index: 1,
            keepAlive: true
        }
    },
    {
        path: '/cat',
        name: 'Cat',
        component: () => import('@/view/cat.vue'),
        meta: {
            tabBar: true,
            index: 1,
            keepAlive: true
        }
    },
    {
        path: '/shopping-cart',
        name: 'shoppingCart',
        component: () => import('@/view/shopping-cart.vue'),
        meta: {
            tabBar: true,
            navBarShow: true,
            title: '购物车',
            index: 1,
            keepAlive: true
        }
    },
    {
        path: '/personal',
        name: 'personal',
        component: () => import('@/view/personal.vue'),
        meta: {
            tabBar: true,
            navBarShow: true,
            title: '我的',
            index: 1,
            keepAlive: true
        }
    },
    {
        path: '/search',
        name: 'search',
        component: () => import('@/view/search.vue'),
        meta: {
            tabBar: false,
            navBarShow: false,
            title: '搜索',
            index: 2,
            keepAlive: true
        }
    },
    {
        path: '/goods-detail',
        name: 'goodsDetail',
        component: () => import('@/view/goods-detail.vue'),
        meta: {
            tabBar: false,
            navBarShow: true,
            title: '商品详情',
            index: 2,
            keepAlive: true
        }
    },
    {
        path: '/:pathMatch(.*)*',
        name: '*',
        redirect: '/',
    }

]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router;